<?php
include_once "objs/Links.php";
include_once "objs/Partners.php";
include_once "objs/News.php";
include_once "models/NewsDao.php";
include_once "models/PartnerDao.php";
include_once "models/LinkDao.php";
include_once "models/Util.php";
include_once "models/MySqlDataAccessHelper.php";
include_once "objs/News.php";
include_once "models/NewsDao.php";

MySqlDataAccessHelper::open();

$links = LinkDao::getLinks();
$partners = PartnerDao::getPartners();
$goodNews = array();

MySqlDataAccessHelper::close();
?>
<div id="zt-colright" >
    <?php if(1){ ?>
    <div class="module-colorfull zt-mod-br">
        <div class="zt-mod-bl">
            <div class="zt-mod-tr">
                <div class="zt-mod-tl clearfix">
                    <h3>
                        <span>Điểm nhấn</span>
                    </h3>
                    <div class="mod-content">
                        <!-- begin diem nhan-->
                        <div class="latestnews" style="width: 100%">
                            <!-- begin diem nhan item-->
                            <div class="latestnewsitems" style="width: 100%">

                                <div class="latestnewsitems-inner">
                                    <a
                                        href="http://www.sait.asia/diem-nhan/187-gia-han-visa-hoa-ky-khong-can-phong-van"
                                        class="latestnews-colorfull"><img
                                            src="imgs/mod_zt_latestnews_2b24d495052a8ce66358eb576b8912c8_60x40_vis.jpg"
                                            alt="Gia hạn Visa Hoa Kỳ không cần phỏng vấn"
                                            border="0"></a>
                                    <div class="hidden">
                                        <h4>
                                            <a
                                                href="http://www.sait.asia/diem-nhan/187-gia-han-visa-hoa-ky-khong-can-phong-van"
                                                class="latestnews-colorfull">Gia hạn Visa Hoa
                                                Kỳ không cần phỏng vấn</a>
                                        </h4>

                                        <span style="margin: 0;"> Người Việt Nam...</span> <span
                                            class="latestnewsdate">06 May 2013</span>

                                    </div>
                                </div>
                            </div>
                            <!--end diem nhan item-->																
                        </div>
                        <!-- end diem nhan-->

                        <div style="display: none;">
                            <a href="http://www.joomlavision.com/"
                               title="Joomla Templates">Joomla Templates</a> and
                            Joomla Extensions by JoomlaVision.Com
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php } ?>
    <?php if(count($partners) > 0){ ?>
    <div class="module-color zt-mod-br">
        <div class="zt-mod-bl">
            <div class="zt-mod-tr">
                <div class="zt-mod-tl clearfix">
                    <h3>
                        <span>Đối tác</span>
                    </h3>
                    <div class="mod-content">


                        <div class="custom-color">
                            <p>
                                <!--begin doitac-->
                                <?php foreach($partners as $obj){ ?>
                                <a href="<?php if(strlen($obj->getLink()) > 0) { echo $obj->getLink();}else {echo 'index.php?#';} ?>"><img
                                        alt="partner" src="<?php echo $obj->getImg();?>" height="59" border="0"
                                        width="108"></a>
                                <?php } ?>
                                <!-- end doi tac-->
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php } ?>
    <?php if(count($goodNews) > 0){ ?>
    <div class="module-color zt-mod-br">
        <div class="zt-mod-bl">
            <div class="zt-mod-tr">
                <div class="zt-mod-tl clearfix">
                    <h3>
                        <span>Bài được quan tâm</span>
                    </h3>
                    <div class="mod-content">
                        <div id="abc_bca" style="display: none;">
                            <a href="http://www.zootemplate.com/"
                               title="Joomla Templates">Joomla Templates</a> and
                            Joomla Extensions by ZooTemplate.Com
                        </div>
                        <div id="jv_accordion151" class="jv_default_accordion">
                            <!-- begin bai duoc quan tam item-->
                            <?php 
                            if(count($goodNews) > 0){ 
                            $titleLength = 50;
                            $firstNew = $goodNews[0];
                            $shortName = $firstNew->getName();
                            if(strlen($shortName) >= $titleLength){
                                $tempPos = mb_strpos($shortName, ' ', $titleLength - 10);
                                $shortName = mb_substr($firstNew->getName(), 0, $tempPos);
                            }
                            $shortGoodNew = Util::getShortContent($firstNew->getContent(), ' ', 130);
                            ?>
                            <div class="jv_accordion">
                                <div class="jv_accordion_item"
                                     onclick="newsclick('newItem_<?php echo $firstNew->getId(); ?>');" style="cursor: pointer; cursor: hand;" >
                                    <a class="toggler atStart151"><span><?php echo $shortName; ?> </span></a>
                                    <div id="newItem_<?php echo $firstNew->getId(); ?>"
                                        style="margin: 0px; position: static; overflow: hidden; height: 240px; display: none">
                                        <div style="margin: 0px; overflow: hidden;"
                                             class="element atStart151" id="content151_<?php echo $firstNew->getId(); ?>">
                                            <div class="answer_text">&nbsp;</div>
                                            <div class="answer_content">
                                                <?php if(strlen($firstNew->getThumbnail()) > 0){ ?>
                                                <a href="tintuc.php?id=<?php echo $firstNew->getId(); ?>">
                                            <img class="jv_thumb_content" style="height: 100px; width: 220px;"
                                                 src="<?php echo $firstNew->getThumbnail(); ?>"/></a>
                                            <?php } ?>
                                             <?php echo $shortGoodNew; ?>... </div>
                                            <div class="readmore"> <a
                                                    href="tintuc.php?id=<?php echo $firstNew->getId(); ?>">Xem
                                                    ti?p</a> </div>
                                            <br clear="all" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php }else{ 
                                echo 'Hiện chưa có bài viết nào!';
                            }
                            ?>
                            <!-- end bai duoc quan tam item-->

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php } ?>
    <!-- begin lien ket -->
    <div class="module-color zt-mod-br">
        <div class="zt-mod-bl">
            <div class="zt-mod-tr">
                <div class="zt-mod-tl clearfix">
                    <h3>
                        <span>Liên kết</span>
                    </h3>
                    <div class="mod-content">

                        <ul class="menu">
                            <!-- begin lien ket item -->
                            <?php foreach($links as $link){ ?>
                            <li id="item-573"><a
                                    href="<?php echo $link->getLink(); ?>" target="_blank">
                                    <?php echo $link->getName(); ?></a></li>
                            <?php } ?>
                            <!-- end lien ket item -->
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end lien ket -->
    <!-- begin specific scope -->
    <div class="module-color zt-mod-br">
        <div class="zt-mod-bl">
            <div class="zt-mod-tr">
                <div class="zt-mod-tl clearfix">
                    <h3>
                        <span>ĐẦU TƯ NHẬN THẺ XANH TẠI MỸ</span>
                    </h3>
                    <div class="mod-content">
                        <!-- begin dau tu nhan the xanh tai my-->
                        <div class="custom-color">
                            <p>
                                <a
                                    href="danhmuc.php?id=16&detail=true"><img
                                        alt="" src="imgs/lucky.jpg"
                                        style="height: 144px; width: 220px;"></a>
                            </p>
                            <p>Luckys Farmers Market là một trong những tập đoàn
                                siêu thị về thực phẩm thành công tại Hoa Kỳ. ...</p>
                            <p style="text-align: right;">
                                <a
                                    href="danhmuc.php?id=48&detail=true">Xem
                                    tiếp...</a>
                            </p>
                        </div>
                        <!-- end dau tu nhan the xanh tai my-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end specific scope -->
</div>